package com.Gwo.org.controller;


import com.Gwo.basic.controller.BaseController;
import com.Gwo.basic.utils.Result;
import com.Gwo.org.domain.Product;
import com.Gwo.org.domain.Product;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/product")
public class ProductController extends BaseController<Product> {
    @PutMapping
    public Result addOrUpdate(@RequestBody Product product){
        if(product.getId()==null){
            baseService.add(product);
            return Result.me().success();
        }else {
            baseService.update(product);
            return Result.me().success();
        }
    }
}
